package com.anyonavinfo.cpaddemo.view.mainview.homepage;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
<<<<<<< HEAD
import android.widget.LinearLayout;
=======
>>>>>>> b56716b621890f59100a220d4c7abe0ddb29e232
import android.widget.RelativeLayout;

import com.anyonavinfo.cpaddemo.MainActivity;
import com.anyonavinfo.cpaddemo.R;
import com.anyonavinfo.cpaddemo.utils.AppManagerUtils;
<<<<<<< HEAD
import com.anyonavinfo.cpaddemo.view.mainview.minimusicplayer.MiniMusicPlayerView;
=======
>>>>>>> b56716b621890f59100a220d4c7abe0ddb29e232


/**
 * Created by ZuiC on 2017/1/16.
 */

public class HomePageView extends RelativeLayout {
    private Context mContext;
    private ImageButton ivOpenSettingsView;
    private ImageView ivOpenAppStore,ivOpenNavigation,ivOpenBluetooth;
<<<<<<< HEAD
    private MiniMusicPlayerView lvMiniMusicPlayerView;
=======
>>>>>>> b56716b621890f59100a220d4c7abe0ddb29e232


    public HomePageView(Context context) {
        super(context);
        initView(context);
    }

    public HomePageView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public HomePageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context){
        this.mContext = context;
        LayoutInflater layoutInflater = LayoutInflater.from(mContext);
        View view = layoutInflater.inflate(R.layout.view_mainview_homepage_homepageview, this);

        ivOpenSettingsView = (ImageButton) view.findViewById(R.id.iv_open_settingsview);
        ivOpenAppStore = (ImageView) view.findViewById(R.id.iv_open_appstore);
        ivOpenBluetooth = (ImageView) view.findViewById(R.id.iv_open_bluetooth);
        ivOpenNavigation = (ImageView) view.findViewById(R.id.iv_open_navigation);
<<<<<<< HEAD
        lvMiniMusicPlayerView = (MiniMusicPlayerView) view.findViewById(R.id.lv_minimusicplayer);
=======
>>>>>>> b56716b621890f59100a220d4c7abe0ddb29e232
        setListener();
    }

    private void setListener(){
        ivOpenSettingsView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ((MainActivity)mContext).displaySettingsView();
            }
        });

        ivOpenAppStore.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                AppManagerUtils.getInstance().launchActivity("com.anyonavinfo.cpadstore");
            }
        });

        ivOpenBluetooth.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                AppManagerUtils.getInstance().launchActivity("com.anyonavinfo.bluetoothphone");
            }
        });

        ivOpenNavigation.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                AppManagerUtils.getInstance().launchActivity("com.wedrive.welink.sgmw.navigation");
            }
        });
<<<<<<< HEAD
    }

    public void onRedisplay(){
        lvMiniMusicPlayerView.onRedisplay();
=======
>>>>>>> b56716b621890f59100a220d4c7abe0ddb29e232
    }

}
